﻿using System;
using System.Collections.Generic;
using System.Text;
using Microsoft.Practices.ObjectBuilder;
using Microsoft.Practices.CompositeWeb;
using CMSWCSFSolution.CMS.Interface.Services;
using CMS.Model;

namespace CMSWCSFSolution.CMS.Views
{
    public class TeacherMainPagePresenter : Presenter<ITeacherMainPage>
    {
        private int _rowCount;
        private ICMSService _service;
        public TeacherMainPagePresenter([CreateNew] ICMSService service)
        {
            _service = service;
        }
        public void onSelectAllTeachers()
        {
            View.BindTeacherList = _service.GetAllTeachers(View.PageIndex, View.PageSize, out _rowCount);
            View.RowCount = _rowCount;
        }
        public void OnDeleteTeacherById()
        {
            int teacherId = View.TeacherId;
            if (teacherId != null)
            {
                _service.DeleteTeacherById(teacherId);
            }
        }
        public override void OnViewLoaded()
        {
        }
        public override void OnViewInitialized()
        {
        }
    }
}




